/****************** Exercise 9 ******************
 * Write a program to demonstrate that
 * autoboxing works for all the primitive types
 * and their wrappers.
 ************************************************/

package thinkinginjava.everything_is_an_object;

/**
 *
 * @author vlad
 */
public class Exercise9 {
    public static void main(String[] args){
        boolean bl = false;
        char ch = 35;
        byte bt = 0;
        short sh = 1;
        int i = 2;
        long l = 3L;
        float f = 3.14F;
        double d = 2.72;
        
        /* autoboxing */
        System.out.println("===== Autoboxing ======");
        Boolean wbl = bl;
        System.out.println("wbl = " + wbl);
        Character wch = ch;
        System.out.println("wch = " + wch);
        Byte wbt = bt;
        System.out.println("wbt = " + wbt);
        Short wsh = sh;
        System.out.println("wsh = " + wsh);
        Integer wi = i;
        System.out.println("wi = " + wi);
        Long wl = l;
        System.out.println("wl = " + wl);
        Float wf = f;
        System.out.println("wf = " + wf);
        Double wd = d;
        System.out.println("wd = " + wd);
        
        /* autounboxing */
        System.out.println("===== Autounboxing ======");
        bl = wbl;
        System.out.println("bl = " + bl);
        ch = wch;
        System.out.println("ch = " + ch);
        bt = wbt;
        System.out.println("bt = " + bt);
        sh = wsh;
        System.out.println("sh = " + sh);
        i = wi;
        System.out.println("i = " + i);
        l = wl;
        System.out.println("l = " + l);
        f = wf;
        System.out.println("f = " + f);
        d = wd;
        System.out.println("d = " + d);
    }
    
}
